﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SharpSoft.Data.Lexing
{
    public class LexerException : Exception
    {
        public LexerException(string message, string context) : base(message)
        {
            Context = context;
        }

        public int Position { get; set; }
        public int Row { get; set; }
        public int Column { get; set; }
        public string Context { get; set; }

        public override string ToString()
        {
            return $"在位置:{Position} 行：{Row + 1} 列：{Column + 1}发生异常。--{Message}\n--上下文:[{Context}]";
        }
    }
}
